﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace BussinessLogic.Exercise
{
    public class ExerciseListItemModel
    {
        public int ID { get; set; }

        [Display(Name = "Name")]
        public string Name { get; set; }

        [Display(Name = "Description")]
        public string Description { get; set; }

        public ActivityType Type { get; set; }
        public bool IsRunning { get; set; }
    }


    public class CreateExercise
    {
        [Required]
        [Display(Name = "Name")]
        public string Name { get; set; }
        [Required]
        [Display(Name = "Description")]
        public string Description { get; set; }
        [Required]
        [Display(Name = "Type")]
        public int ExerciseType { get; set; }
        public List<ExerciseType> ExerciseTypes { get; set; }
        public int ID { get; set; }

        public bool IsRunning { get; set; }
    }

    public class ExerciseType
    {
        public int ID { get; set; }
        public string Name { get; set; }
    }


    public class SelectPicture
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public List<string> NeutralPhotos { get; set; }
        public List<string> NegativePhotos { get; set; }
    }

    public class MatrixExerciseMaintain
    {
        public int ID { get; set; }
        public List<string> NeutralPhotos { get; set; }

        public List<string> NegativePhotos { get; set; }

        public List<string> SavedNeutralPhotos { get; set; }
        public List<string> SavedNegativePhotos { get; set; }

        [Display(Name = "Number of trials")]
        public int TrialsCount { get; set; }

        public bool IsRunning { get; set; }
    }

    public class ExerciseMaintain
    {
        public int ID { get; set; }
        [Display(Name = "Name")]
        public string Name { get; set; }
        [Display(Name = "Picture Timeout")]
        public int PictureTime { get; set; }
        [Display(Name = "Number Timeout")]
        public int CrossNumberTime { get; set; }
        [Display(Name = "Acomodation Trials")]
        public int BaselineTrials { get; set; }

        public List<string> NeutralPhotos { get; set; }
        public List<string> NegativePhotos { get; set; }

        public List<string> SavedNeutralPhotos { get; set; }
        public List<string> SavedNegativePhotos { get; set; }

        public List<int> CheckedTrials { get; set; }
        public List<int> CheckedTrialsRepeat { get; set; }
        

        public List<ExerciseTrial> Trials { get; set; }
        public List<ExerciseTrial> SavedTrials { get; set; }

        [Display(Name = "Final session")]
        public bool FinalSession { get; set; }

        [Display(Name = "Fixation trials")]
        public int FixationTrials { get; set; }
        public bool IsRunning { get; set; }
    }


    public class ExerciseTrial
    {
        public enum LetterType
        {
            E,
            F
        }

        public enum Position
        {
            Up,
            Down
        }

        public enum SequenceType
        {
            Fixation,
            Acomodation,
            Baseline,
            Training,
            Final,
        }

        public int ID { get; set; }

        public string NeutralPhoto { get; set; }
        public string NegativePhoto { get; set; }
        public int ReactionTime { get; set; }
        public bool Correct { get; set; }
        public bool NegativeNeutral { get; set; }
        public SequenceType SType { get; set; }
        public bool Checked { get; set; }
        public LetterType Letter { get; set; }
        public Position LetterPosition { get; set; }
        public Position NeutralPosition { get; set; }
        public bool Convergent { get { return LetterPosition != NeutralPosition; } }

        public ExerciseTrial Clone()
        {
            ExerciseTrial trial = new ExerciseTrial();
            trial.Letter = Letter;
            trial.LetterPosition = LetterPosition;
            trial.NeutralPosition = NeutralPosition;
            trial.NeutralPhoto = NeutralPhoto;
            trial.NegativePhoto = NegativePhoto;
            trial.NegativeNeutral = NegativeNeutral;

            return trial;
        }

        public int Digit { get; set; }

        public int Repeat { get; set; }
    }

    public class ExerciseProtocol
    {
        public List<string> UpPhotos { get; set; }
        public List<string> DownPhotos { get; set; }
        public int PictureTime { get; set; }
        public int CrossNumberTime { get; set; }
        public int AcomodationTrials { get; set; }

        public List<ExerciseTrial> Trials { get; set; }

        public bool FinalSession { get; set; }

        public int FixationTrial { get; set; }
    }
}
